package krillr.Util;

/**
 * Rectagle2d - A specialized rectangle based on Rectangle2D to help simplify bullet tracking
 * 
 * @author Aaron M. Krill
 * @version 0.1
 */
public class Rectangle2d extends java.awt.geom.Rectangle2D.Double {
    /**
     * Constructs a point at the specified x and y coordinates
     * 
     * @param x - x coordinate for the new rectangle
     * @param y - y coordinate for the new rectangle
     * @param w - width for the new rectangle
     * @param h - height for the new rectangle
     */
    public Rectangle2d(double x, double y, double w, double h) {
        super(x, y, w, h);
    }
    
    /**
     * Constructs a rectangle at the same position with the same width/height as the specified rectangle
     * 
     * @param r - the rectangle to mimic
     */
    public Rectangle2d(Rectangle2d r) {
        super(r.x, r.y, r.width, r.height);
    }
     /**
     * Checks to see if a bullet is still on the field
     * 
     * @param b - the bullet we're checking
     * @param t - the current game time
     */
    public boolean containsBullet(BulletTracker b, double t) {
        return contains(b.currentLocation(t));
    }
}